package StudyCode.summary.myfile;

import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CheckFileAccessibilityLevel {
	public static void main(String[] args) {
		Path path = FileSystems.getDefault().getPath("E:\\迅雷下载\\test1.txt");
		boolean is_readable = Files.isReadable(path);
		boolean is_writable = Files.isWritable(path);
		boolean is_executable = Files.isExecutable(path);
		boolean is_regular = Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS);

		if ((is_readable) && (is_writable) && (is_executable) && (is_regular)) {
			System.out.println("检查的文件可访问!");
		} else {
			System.out.println("检查的文件不可访问!");
		}

	}
}
